<?php 

namespace app\admin\controller;

use think\Controller;
use think\Session;

class Base extends Controller
{
	protected function _initialize(){
		parent::_initialize();
		// 判断用户是否登录
		define('USER_ID', Session::get('userId'));
	}
    // 判断用户是否登录
    protected function isLogin(){
    	if(is_null(USER_ID)){
    		$this -> redirect('login/index');
    	}
    }
    // 判断用户是否重复登录
    protected function alreadyLogin(){
    	if(!is_null(USER_ID)){
    		$this -> redirect('index/index');
    	}
    }
}
